import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;

import java.util.Arrays;

// JFinal 拦截器方式
public class TestActiveRecordInterceptor implements Interceptor {

    public void intercept(Invocation invocation) {
        System.out.println(invocation.getMethodName());
        if (Arrays.asList("update","save","delete","batch","batchUpdate","batchDelete").contains(invocation.getMethodName())){
            Object[] args = invocation.getArgs();
            System.out.println(Arrays.toString(args)); //sql 和 参数
        }
        invocation.invoke();
        Object result = invocation.getReturnValue();
        System.out.println(result);
    }
}
